import 'package:fish_redux/fish_redux.dart';
import 'package:member_center_sdk_example/models/member.dart';

enum MemberCenterAction {
  init,
  loadErr,
  noLogin,
  loading,
  login,
  reload,
  setNickName,
  setEmail,
  setAvater,
  setPassword,
  updateAvaterUrl,
  updateNickName,
  updateEmail,
  updateHasPassword,
  logout
}

class MemberCenterActionCreator {
  static Action initAction(Member member) {
    return Action(MemberCenterAction.init, payload: member);
  }

  static Action loadingAction() {
    return Action(MemberCenterAction.loading);
  }

  static Action loadErrAction() {
    return Action(MemberCenterAction.loadErr);
  }

  static Action noLoginAction() {
    return Action(MemberCenterAction.noLogin);
  }

  static Action reloadAction() {
    return Action(MemberCenterAction.reload);
  }

  static Action loginAction() {
    return Action(MemberCenterAction.login);
  }

  static Action logoutAction() {
    return Action(MemberCenterAction.login);
  }

  static Action setNickNameAction() {
    return Action(MemberCenterAction.setNickName);
  }

  static Action setEmailAction() {
    return Action(MemberCenterAction.setEmail);
  }

  static Action setAvaterAction() {
    return Action(MemberCenterAction.setAvater);
  }

  static Action setPasswordAction() {
    return Action(MemberCenterAction.setPassword);
  }

  static Action updateAvaterUrlAction(String url) {
    return Action(MemberCenterAction.updateAvaterUrl, payload: url);
  }

  static Action updateNickNameAction(String nickName) {
    return Action(MemberCenterAction.updateNickName, payload: nickName);
  }

  static Action updateEmailAction(String email) {
    return Action(MemberCenterAction.updateEmail, payload: email);
  }

  static Action updateHasPasswordAction(bool has) {
    return Action(MemberCenterAction.updateHasPassword, payload: has);
  }
}
